--handels levels
dofile("physic.lua")
dofile("graphic.lua")
dofile("map.lua")
level = {}
function level.loadLevel(_map)
	level.tileSet = graphic.loadTileset(_map.tilePicture, _map.tileSize, _map.tileSize) --background, rivers
	level.BACKGRUND = graphic.creatTileBatch(level.tileSet, _map.tileMap)
	
	
	MAP_WIDTH = 800 --260 is default later we will use map.width
	MAP_HEIGHT = 596 --260 is default later we will use map.height
	MAP_X = 0 
	MAP_Y = 0


	elements = {Barrel, Hero, Fireball, redfish, FollowingDog}

	graphic.loadPO(elements)
	physic.createPO(MAP_WIDTH,MAP_HEIGHT,BOXES_WIDTH, BOXES_HEIGHT)
	
	hero =  gameFunction.createNewHero()
	physic.addPO(hero)

	-- create Following Dog
	dog = FollowingDog:new()
	dog.misc.follows = hero	
	physic.addPO(dog)	


	monsters = {}
	for i= 1, 200 do
		monsters[i] = gameFunction.createBarrel()
	end
	
	for _,element in ipairs(monsters) do
		physic.addPO(element)
	end

	-------Monster
	-- load triger points
	-- load monsters
	-- load position of monsters
	-- load items
	-- load chests
	-- load hero
	-- load spells
	
end
